package com.mdz.nc.Controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdz.nc.Entity.SysMc;
import com.mdz.nc.Entity.SysNc;
import com.mdz.nc.Mapper.SysMcMapper;
import com.mdz.nc.Mapper.SysNcMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 孟德志
 * @create 2019-12-15-2:46
 */
@Controller
public class LoginController {

    @Autowired
    private SysNcMapper sysNcMapper;

    @Autowired
    private SysMcMapper sysMcMapper;

    @RequestMapping("/index")
    public String index(Integer mkid,ModelMap map){
        List<SysNc> sysNclist101=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("mkid",101).eq("is_rd",1).isNull("is_js"));
        map.put("sysNclist101",sysNclist101);
        List<SysNc> sysNclist201=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("mkid",201).eq("is_rd",1).isNull("is_js"));
        map.put("sysNclist201",sysNclist201);
        List<SysNc> sysNclist301=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("mkid",301).eq("is_rd",1).isNull("is_js"));
        map.put("sysNclist301",sysNclist301);
        List<SysNc> sysNclist401=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("mkid",401).eq("is_rd",1).isNull("is_js"));
        map.put("sysNclist401",sysNclist401);
        List<SysNc> sysNclist501=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("mkid",501).eq("is_rd",1).isNull("is_js"));
        map.put("sysNclist501",sysNclist501);
        List<SysNc> sysNclist601=sysNcMapper.selectList(new QueryWrapper<SysNc>().eq("is_js",1).eq("is_rd",1));
        map.put("sysNclist601",sysNclist601);
        return "index";
    }

    @RequestMapping("/login")
    public String login(){
        return "login";
    }

    @RequestMapping("/select")
    public String select(){
        return "select2";
    }

    @RequestMapping("/scan")
    public String scan(){
        return "scan";
    }

    @RequestMapping("/cam")
    public String cam(){
        return "cam";
    }

    @RequestMapping("/shouji")
    public String shouji(){
        return "shouji";
    }

    @RequestMapping("/form")
    public String form(ModelMap map){
        List<SysMc> sysMcs=sysMcMapper.selectList(null);
        map.put("sysmcs",sysMcs);
        return "form";
    }

    @RequestMapping("/weihu")
    public String weihu(){
        return "weihu";
    }

    @GetMapping("/a")
    public String a()
    {
        return  "a";
    }

    @GetMapping("/b")
    public String b()
    {
        return  "b";
    }

    @GetMapping("/demo/modal/ypdx")
    public String ypdx()
    {
        return  "ypdx";
    }
}
